<?php
/*
Template Name: home
*/
?>
<?php get_header(); ?>

<div id='content' class="grid_9">
	<div id="contentContainer" class='box-shadow'>
	<?php if (have_posts()) : ?>
						
						<?php while (have_posts()) : the_post(); ?>

						<?php the_content('(Read the rest of this entry...)'); ?>
						</div> <!-- Closes Post -->
						
						<?php endwhile; ?>
						
						<?php else : ?>
						
						<div class="post">
						<h2 class="center">Not Found</h2>
						<p class="center">Sorry, but you are looking for something that isn't here.</p>
						<div class="search">
						<?php include (TEMPLATEPATH . "/searchform.php"); ?>
						</div> <!-- Closes Search -->
						</div> <!-- Closes Post -->
						
						<?php endif; ?>
		<div id='newest_members' class='box-shadow'>
		<h3 class='h3-banner'><span>Newest Members</span></h3>
    		<?php 
    			query_posts('showposts=3'); 
    			$count = 1;
    		?>
    		
    		<?php while (have_posts()) : the_post(); ?>
    		<?php
    			if($count == 1){
    				echo "<div class='new_members grid_3 alpha'>";
    			}
    			else if($count == 3){
    				echo "<div class='new_members grid_3 omega'>";
    			}
    			else{
    				echo "<div class='new_members grid_3'>";
    			}
    		?>
    		<?php $url = get_post_meta($post->ID, 'kda_memeber-site-url', true);	?>
    		<?php 
				$imageurl = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
			?>
				<a href="<?php echo $url; ?>" target="_blank"><img src="<?php echo $imageurl; ?>" longdesc="URL_2" alt="Text_2" width='100px'/></a>
			
			
            	<br/><a class="catLink" href="<?php echo $url; ?>" target="_blank"><?php the_title(); ?></a>
            	</div>
            <?php	$count++; ?>
    		<?php endwhile;?>
    		<?php wp_reset_query(); ?> 
		</div>
	    <div id="tricontent">    
			<div class="grid_5 alpha box">
				<div class='inside-box'>
				<h3 class='h3-banner'><span>Blog</span></h3>
				<!--	<?php if (function_exists('dynamic_sidebar')) {dynamic_sidebar('blog');} ?>-->
	<ul class='blog-posts'>
	<?php switch_to_blog(2); ?>
	<?php query_posts('showposts=1'); ?>

<?php while (have_posts()) : the_post(); ?>
<li><h3><a href="<?php the_permalink() ?>"><?php the_title(); ?></a> <?php the_date(); ?></h3>
<?php the_excerpt(__('(more…)')); ?>
</li>
<?php endwhile;?>
	<?php restore_current_blog(); ?>
	</ul>
				</div>
			</div>

            <div class="grid_4 omega box">
            	<div class='inside-box'>
            	<h3 class='h3-banner'><span>Newsletter</span></h3>
            	<?php if (function_exists('dynamic_sidebar')) {dynamic_sidebar('newsletter');} ?>
					
				</div>
			</div>
		</div>
</div>

<div class='grid_3 sidebar-container'>
        <?php if (function_exists('dynamic_sidebar')) {dynamic_sidebar('home-right-ad-space');} ?>
</div>
 
<?php get_footer(); ?>        
    
    
    
    
		
